// 引入Service和请求头ServiceName
import { Service, ServiceName } from '@/network/http.js'
import store from '@/store/index.js' // 引入store
const api = {
  /**
     * 获取票货数据
     * @param {Object} params 检索条件的obj
     */
  reqGetTickets(params) {
    return Service.get(
      `/${ServiceName}/api/external/busCargoInfo/queryall`,
      { params }
    )
  },
  /**
     * 新建票货数据
     * @param {Object} params 新建票货的obj
     */
  reqAddTickets(params) {
    store.commit('changeStatus', true)
    return Service.post(
      `/${ServiceName}/api/external/busCargoInfo/add`,
      params
    )
  },

  /**
     * 货权保存
     * @param {Object} params 货权保存的obj
     */
  reqSaveCargo(params) {
    store.commit('changeStatus', true)
    return Service.post(
      `/${ServiceName}/api/external/busCargoInfo/cargoOwnerTransfer`,
      params
    )
  },

  /**
     * 货权查询
     * @param {Object} params 货权查询的obj
     */
  reqGetCargo(params) {
    return Service.get(
      `/${ServiceName}/api/external/busCargoInfo/queryTransferInfoList`,
      { params }
    )
  }
}
export default api
